﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Windows;
using MovieRental.BuisnessComponents;
using MovieRental_Presentation.DataViews;
using System.Windows.Controls;
using System.Windows.Threading;
using System.Net;

namespace MovieRental_Presentation
{
	/// <summary>
	/// Interaction logic for App.xaml
	/// </summary>
	public partial class App : Application
	{
        public App()
        {
            CartDataView = new CartDataView();
            DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException);
        }

        public event EventHandler WebPageNotFoundExceptionHandler;

        void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
        {
            if (e.Exception is WebException)
            {
                if (WebPageNotFoundExceptionHandler != null)
                    WebPageNotFoundExceptionHandler(this, null);
                e.Handled = true;
            }
        }

        public CartDataView CartDataView { private set; get; }   
	}
}